package learn.java.aop.jdkproxy;

import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author zhengsu
 */
@Slf4j
public class NameServiceInvcationHanlder implements InvocationHandler {

    @Setter
    @Getter
    private Object target;


    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println(method.getName() + "执行前");
        Object invoke = method.invoke(target, args);
        System.out.println(method.getName() + "执行后");
        return invoke;
    }
}
